package com.sailfish.mq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/producer")
public class ProducerController {
    @Autowired
    KafkaTemplate kafkaTemplate;

    @PostMapping(value = "/send/{topic}/{msg}")
    public String send(@PathVariable(value = "topic") String topic, @PathVariable(value = "msg") String msg) {
        //消息发送
        kafkaTemplate.send(topic, msg);
        return "SUCCESS";
    }
}
